package com.djl.rabbitmq.eight;

import com.djl.rabbitmq.utils.RabbitMqUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: rabbitmq-hello
 * @description: 死信实战队列 消费者1
 * @author: Mr.dai
 * @create: 2021-09-13 10:08
 **/

public class ConSumer02 {

//    死信队列名称
    public static final String DEAD_QUEUE="dead_queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        System.out.println("等待接收消息。。。");
        DeliverCallback deliverCallback=( consumerTag,  message)->{
            System.out.println(new String(message.getBody(), StandardCharsets.UTF_8));

        };

        channel.basicConsume(DEAD_QUEUE,true, deliverCallback,consumerTag -> {

        });
    }



}
